-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prevent reimports for TF #1713
Prevent reimports for TF #1713
Conversation
Here is an overview of what got changed by this pull request: Complexity increasing per file
==============================
- datumaro/datumaro/util/tf_util.py 2
See the complete overview on Codacy |
Pull Request Test Coverage Report for Build 5760
💛 - Coveralls |
@@ -35,16 +35,23 @@ def check_import(): | |||
def import_tf(check=True): | |||
import sys | |||
|
|||
tf = sys.modules.get('tensorflow', None) | |||
if tf is not None: | |||
not_found = object() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it performance optimisation? Could you please add a comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not entirely. It is a way to be sure about the result of get()
call. The problem with default None
is that it is a valid value for a module, and, moreover, we need it later. Using some specific object()
we can be sure about existence of a key and its value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Motivation and context
import
expression if an import error happensHow has this been tested?
Manual test
Checklist
develop
branchcvat-core, cvat-data and cvat-ui)
License
Feel free to contact the maintainers if that's a concern.